<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class AddToStatPayLogTable extends Migration
{
    protected $connection = 'stat';

    public function up(): void
    {
        Schema::create('stat_daily_pay_info', function (Blueprint $table) {
            $table->increments('id');
            $table->date('dt')->comment('统计日期');
            $table->unsignedSmallInteger('pay_order_num')->default(0)->comment('充值订单数');
            $table->unsignedSmallInteger('pay_user_num')->default(0)->comment('充值用户数');
            $table->unsignedSmallInteger('pay_rmb_num')->default(0)->comment('充值总金额');
            $table->unsignedSmallInteger('wechat_order_num')->default(0)->comment('微信订单数');
            $table->unsignedSmallInteger('wechat_rmb_num')->default(0)->comment('微信充值金额');
            $table->unsignedSmallInteger('alipay_order_num')->default(0)->comment('支付宝订单数');
            $table->unsignedSmallInteger('alipay_rmb_num')->default(0)->comment('支付宝充值金额');
            $table->unsignedSmallInteger('fail_order_num')->default(0)->comment('未成功订单数');
            $table->unsignedSmallInteger('fail_user_num')->default(0)->comment('未成功充值用户数');
            $table->string('order_num_info', 200)->default('')->comment('各金额充值数');
            $table->string('user_num_info', 200)->default('')->comment('各金额充值用户数');
            $table->unsignedTinyInteger('flag')->default(1)->comment('记录状态');
            $table->timestamps();
            $table->index('dt', 'dt');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('stat_pay_log', function (Blueprint $table) {
            //
        });
    }
}
